package drawing;

import javax.swing.JFrame;

public class CgPanelTest {
	public static void main(String[] args) {
		//runtest();
		final String lock = "test";
		final String lock2 = "test2";
		Thread one = new Thread(new Runnable() {
			
			@Override
			public void run() {
			System.out.println("one");
			try {
				synchronized (lock) {
					lock.wait();	
				}
			} catch (InterruptedException e1) {
			}
			System.out.println("onebistwo");
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			synchronized (lock2) {

				lock2.notify();
					
			}}
		});
		Thread two = new Thread(new Runnable() {
			
			@Override
			public void run() {
			System.out.println("three");
			try {
				Thread.sleep(100);
			} catch (InterruptedException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}synchronized (lock) {

				lock.notify();
					
			}try {
				synchronized (lock2) {

					lock2.wait();
					
				}} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			System.out.println("twobis");
			}
		});
		one.start();
		two.start();
	}

	private static void runtest() {
		CgPanel panel = new CgPanel();
		JFrame frame = new JFrame("atitle");
		frame.getContentPane().add(panel);
		frame.setBounds(0, 0, 1000, 1000);
		panel.setBounds(0, 0, 1000, 1000);
		frame.setVisible(true);
		panel.setVisible(true);

		for (int i = 0; i < 100; i++) {
			for (int j = 0; j < 100; j++) {
				panel.drawPixel(i, j, 1, 0, 0);
			}
		}
	}
}
